
import NumStore from '@/store/NumStore'
import { useDispatch, useSelector } from 'react-redux'

export default function List() {
  const {num} = useSelector((state:RootState)=>({num:state.NumStore.num}))
  const {list} = useSelector((state:RootState)=>({list:state.ArrStore.list}))
  const dispath = useDispatch()
  const changeNum = ()=>{
    dispath({type:'add',value:3})
  }
  const changeNum3 = ()=>{
    dispath(NumStore.asyncActions.asyncAdd)
  }
  const changeArr = ()=>{
    dispath({type:'changeList',value:[1,2,3,4]})
  }
  return (
    <div>list{num} <button onClick={changeNum}>add</button> <button onClick={changeNum3}>add3</button> <p>{list}</p> <button onClick={changeArr}>changeArr</button></div>
  )
}
